-- CALC_UPGRADE_CAREER_COST

-----------------------------------------------
--  计算称号消耗探索点减少的千分比
-- @param  departmentId 系别
return function(departmentId, value, fixCo)
    -- 百分比降低探索点消耗
    local addon = 0;
    -- 降低学习消耗属性
    local prop = PropM.combine(ME.user, "skill_cost", 1);
    addon = addon + prop[3];

    -- 降低副系学习消耗属性
    prop = PropM.combine(ME.user, "skill_assist_cost", 1);
    if fixCo == 2 then
        addon = addon + prop[3];
    end

    -- 降低特定系的消耗属性
    prop = PropM.combine(ME.user, "skill_type_cost", departmentId);
    addon = addon + prop[3];

    -- 魔之右眼：降低特定系的消耗属性
    prop = PropM.combine(ME.user, "magic_eye", departmentId);
    addon = addon + prop[3];

    -- 探索点消耗减少属性影响
    prop = PropM.combine(ME.user, "cost", "search_point");
    addon = addon + prop[3];

    -- 上限修正
    addon = math.min(900, addon);
    value = value - math.modf(value * addon / 1000);

    -- 阵营降低特定系的消耗
    local pet = ME.user:getActivePet();
    local classId = pet.classId;
    local campId = CampM.getPetCamp(classId);
    if departmentId == 1 then
        prop = PropM.combine(ME.user, "camp_learn_phy", campId);
        value = PropM.apply(prop, value);
    elseif departmentId == 2 then
        prop = PropM.combine(ME.user, "camp_learn_magic", campId);
        value = PropM.apply(prop, value);
    elseif departmentId == 4 then
        prop = PropM.combine(ME.user, "camp_learn_adventure", campId);
        value = PropM.apply(prop, value);
    elseif departmentId == 8 then
        prop = PropM.combine(ME.user, "reduce_attrib2", "dragon_power");
        value = PropM.apply(prop, value);
    end

    return value;
end

